<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>运费模板详情</title>
    <link rel="stylesheet" href="../../css/wxq.css">
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../../font/css/font-awesome.min.css">
    <style>
        .set-freight input{max-width: 60px!important;}
    </style>
</head>
<body>

<!--头部公共样式-->
<header class="header">
    <div class = "logo float_left"><a href="../index/index.html">后台管理系统</a></div>
    <div class = "header_right">
        <nav>
            <ul>

                <li>
                    <a title="更多"><i class = "fa fa-navicon"></i></a>
                    <ul class="dropdown_menu">
                        <li id = "logout">&nbsp;<i class = "fa fa-sign-out"></i>&nbsp;退出</li>
                    </ul>
                </li>
                <li>
                    <a href="../message/messages.html" title = "消息"><i class = "fa fa-envelope"></i></a>
                    <span class="message_count"></span>
                </li>
            </ul>
        </nav>
        <div class = "message_warp_info"></div>
    </div>
</header>

<div class="container">

    <!--左边导航区-->
    <div class="slide" id ="slide">

        <!--左边管理员信息区域-->
        <div class = "admin_info">
            <a href="#" class = "admin_header_img">
                <img src="../../images/test_header.png" alt="">
                <div class = "upload_header_img">更换</div>
            </a>
            <div class = "admin_detail">
                <span class = "admin_type">超级管理员</span>
                <span class = "admin_name">王小强</span>
            </div>
        </div>

        <!--左边导航按钮区域-->
        <ul class = "menu" >
            <li>
                <a href="../index/index.html" class="super_menu">
                    <i class="fa fa-home"></i>&nbsp;&nbsp;首页
                </a>
            </li>
            <li>
                <a class="super_menu">
                    <i class="fa fa-gears"></i>&nbsp;&nbsp;系统配置<i class="fa fa-angle-right"></i>
                </a>
                <ul class = "menu_child_list" >
                    <li>
                        <a href="../conf/bannerSetting.html">
                            <i class="fa fa-image"></i>&nbsp;&nbsp;banner管理
                        </a>
                    </li>
                </ul>
            </li>

            <li>
                <a class="super_menu">
                    <i class="fa fa-users"></i>&nbsp;&nbsp;用户管理<i class="fa fa-angle-right"></i>
                </a>
                <ul class = "menu_child_list isSuper" >
                    <li>
                        <a href="../user/userList.html">
                            <i class="fa fa-user"></i>&nbsp;&nbsp;用户列表
                        </a>
                    </li>
                    <li>
                        <a href="../member/memberManagement.html">
                            <i class="fa fa-user-plus"></i>&nbsp;&nbsp;会员管理
                        </a>
                    </li>
                    <li>
                        <a href="../member/integralSetting.html">
                            <i class="fa fa-vcard"></i>&nbsp;&nbsp;积分设置
                        </a>
                    </li>
                </ul>
            </li>
            <li>
                <a class="super_menu active">
                    <i class="fa fa-cart-plus"></i>&nbsp;&nbsp;商城管理<i class="fa fa-angle-right"></i>
                </a>
                <ul class = "menu_child_list isSuper" style="display: block">
                    <li>
                        <a href="../category/goodsCategory.html">
                            <i class="fa fa-bar-chart"></i>&nbsp;&nbsp;商品分类
                        </a>
                    </li>
                    <li>
                        <a href="freightTemplate.html">
                            <i class="fa fa-cart-arrow-down"></i>&nbsp;&nbsp;运费模板
                        </a>
                    </li>
                    <li>
                        <a href="../goods/goodsList.html">
                            <i class="fa fa-list"></i>&nbsp;&nbsp;商品列表
                        </a>
                    </li>
                    <li>
                        <a href="../order/orderList.html">
                            <i class="fa fa-first-order"></i>&nbsp;&nbsp;订单管理
                        </a>
                    </li>
                </ul>
            </li>
            <li>
                <a href="../message/messages.html" class="super_menu">
                    <i class="fa fa-comment"></i>&nbsp;&nbsp;消息管理
                </a>
            </li>
            <li>
                <a href="../index/dataStatistics.html" class="super_menu">
                    <i class="fa fa-signal"></i>&nbsp;&nbsp;数据统计
                </a>
            </li>
            <li>
                <a href="../admin/authoritySetting.html" class="super_menu">
                    <i class="fa fa-unlock"></i>&nbsp;&nbsp;权限管理
                </a>
            </li>
        </ul>
    </div>

    <div class="main_content">

        <div class="warp">
            <div class = "position">
                <span>当前位置：</span>
                <span>
                    <a>商城管理/</a>
                    <a href="freightTemplate.html">运费模板管理/</a>
                    <a href="addFreightTemp.html">运费模板详情</a>
                </span>
            </div>
        </div>

        <div class="warp"  >
            <div class = "form" id = "freight_obj">
                <div class = "form_item">
                    <label for="name" class="form_label">模板名</label>
                    <div class = "input_div_block input_t_single">
                        <input type="text" id="name" placeholder="模板名" :value="resources.name" class = "form_input">
                    </div>
                </div>

                <div class = "form_item">
                    <label for="is_free" class="form_label">是否包邮</label>
                    <div class = "input_div_block input_t_single set_height" >
                        <div class = "input_div_block">
                            <select class="form_input" id = "is_free">
                                <option value="false" :selected="resources.is_free">不包邮</option>
                            </select>
                        </div>
                    </div>
                </div>

                <div class = "form_item">
                    <label for="deliver_area" class="form_label">发货地点</label>
                    <div class = "input_div_block input_t_single set_height" id = "deliver_area">

                        <div class = "input_div_block w_4">
                            <select class="form_input" id = "province" onchange="removeCity()">
                                <option value="">--省--</option>
                            </select>
                        </div>
                        <div class = "input_div_block w_4 set_margin">
                            <select class="form_input" id = "city" onchange="removeCounty()">
                                <option value="">--市--</option>
                            </select>
                        </div>
                        <div class = "input_div_block w_4">
                            <select class="form_input" id = "county">
                                <option value="">--区--</option>
                            </select>
                        </div>

                    </div>
                </div>
                <div class = "form_item">
                    <label for="detail" class="form_label"></label>
                    <div class = "input_div_block input_t_single">
                        <textarea  id="detail" placeholder="详细地址" :value="resources.detail" class = "form_textarea" ></textarea>
                    </div>
                </div>
                <div class = "form_item">
                    <label for="transport" class="form_label">运输方式</label>
                    <div class = "input_div_block input_t_single set_height">
                        <div class = "input_div_block">
                            <select class="form_input" id = "transport">
                                <option value="本地运输">本地运输</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class = "form_item">
                    <label class="form_label">运费设置</label>
                    <div class = "input_div_block input_t_single set_height" >
                        <div class = "input_div_block set-freight" >
                            <input type="number" min="0" id="BaseKM"  :value="local_json.BaseKM" class = " form_inline"/>
                            <span>公里内</span>
                            <input type="number" min="0" id="price"  :value="local_json.price" class = " form_inline"/>
                            <span>元，不超出</span>
                            <input type="number" min="0" id="maxKM"  :value="local_json.maxKM" class = " form_inline"/>
                            <span>公里，每增加</span>
                            <input type="number" min="0" id="perKM"  :value="local_json.perKM" class = " form_inline" />
                            <span>公里，价格增加</span>
                            <input type="number" min="0" id="KMPrice" :value="local_json.KMPrice" class = " form_inline"/>
                            <span>元</span>
                        </div>
                    </div>
                </div>

                <div class = "form_item">
                    <label for="submit" class="form_label"></label>
                    <div class = "input_div_block input_t_single" >
                        <button class="btn btn_default" id = "submit">提交</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src = "../../js/jquery-3.2.1.min.js"></script>
<script src="../../my_js/sockjs.min.js"></script>
<script src="../../my_js/stomp.min.js"></script>
<script src = "../../my_js/common.js"></script>
<script src = "../../js/wxq.js"></script>
<script src = "../../js/vue.min.js"></script>
<script src = "../../js/add_address.js"></script>
<script src = "../../js/nicevalidate.js"></script>
<script>
    let id = wxqUI.getUrlParam("id");//修改运费模板通用id
    let fapp = new Vue({
        el:"#freight_obj",
        data:{
            resources:[],
            local_json:[]
        },
        mounted:function () {
            $.get(rootPath+"/freight/"+id,(res)=> {
                if(res.meta.code===200){
                    this.resources = res.data;
                    this.local_json = JSON.parse(res.data.local_json);
                    this.setDefaultP()
                }else {
                    alert(res.data);
                }
            });
        },
        methods:{
            setDefaultP: function() {
                let current_province = $("#province").children();
                for(let p_item in current_province){
                    if(this.resources.province === current_province[p_item].innerHTML){
                        $("#province").val(this.resources.province)
                        removeCity()
                    }
                }

                let current_city = $("#city").children();
                for(let c_item in current_city){
                    if(this.resources.city === current_city[c_item].innerHTML){
                        $("#city").val(this.resources.city);
                        removeCounty()
                    }
                }

                let current_county = $("#county").children();
                for(let co_item in current_county){
                    if(this.resources.county === current_county[co_item].innerHTML){
                        $("#county").val(this.resources.county);
                    }
                }
            }
        }
    })

</script>
<script src = "https://webapi.amap.com/maps?v=1.3&key=b52e24deee4f9c48d853f454e65a9994"></script>
<script src = "../../my_js/freightTemplateD.js"></script>
</body>
</html>